package com.pair.micro.fee.modules.charge.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.pair.micro.common.mybatis.service.impl.BaseServiceImpl;
import com.pair.micro.common.utils.PageResult;
import com.pair.micro.fee.modules.charge.convert.RoomOwnerConvert;
import com.pair.micro.fee.modules.charge.dao.RoomOwnerDao;
import com.pair.micro.fee.modules.charge.entity.RoomOwnerEntity;
import com.pair.micro.fee.modules.charge.query.RoomOwnerQuery;
import com.pair.micro.fee.modules.charge.service.RoomOwnerService;
import com.pair.micro.fee.modules.charge.vo.RoomOwnerVO;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@AllArgsConstructor
public class RoomOwnerServiceImpl extends BaseServiceImpl<RoomOwnerDao, RoomOwnerEntity> implements RoomOwnerService {

    @Override
    public PageResult<RoomOwnerVO> page(RoomOwnerQuery query) {
        IPage<RoomOwnerEntity> page = baseMapper.getRoomOwnerList(getPage(query), query);

        return new PageResult<>(RoomOwnerConvert.INSTANCE.convertList(page.getRecords()), page.getTotal());
    }
}
